<!DOCTYPE HTML>
<html>
<head>
    <title>智能引擎系统</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
    <link rel="stylesheet" href="css/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/common/form-elements.css">
    <link rel="stylesheet" href="css/common/style.css">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="js/libs/jquery-3.2.1.js"></script>
    <script src="js/libs/jquery.validate.js"></script>
    <script src="css/bootstrap/js/bootstrap.min.js"></script>
    <script src="js/jquery/jquery.backstretch.min.js"></script>
    <script src="js/common/common.js"></script>
</head>
<body>
<!-- contact-form -->
<div class="container" style="margin-top:180px" >
    <div class="inset">
        <div class="login-head">
            <table class="table table-bordered table-striped" style="white-space: nowrap; vertical-align:middle">
                <tr><td colspan="4">智能引擎系统运行情况</td></tr>
                <tr>
                    <td width="20%">服务</td>
                    <td width="20%">状态</td>
                    <td width="20%">耗时(ms)</td>
                    <td width="40%">备注</td>
                </tr>
                <tr>
                    <td>DB</td>
                    <td><label id="dbStatus">...</label></td>
                    <td><label id="dbCost">...</label></td>
                    <td><label id="dbMessage">...</label></td>
                </tr>
                <tr>
                    <td>NAS</td>
                    <td><label id="nasStatus">...</label></td>
                    <td><label id="nasCost">...</label></td>
                    <td><label id="nasMessage">...</label></td>
                </tr>
                <tr>
                    <td>ZK</td>
                    <td><label id="zkStatus">...</label></td>
                    <td><label id="zkCost">...</label></td>
                    <td><label id="zkMessage">...</label></td>
                </tr>
                <tr>
                    <td>SOLR</td>
                    <td><label id="solrStatus">...</label></td>
                    <td><label id="solrCost">...</label></td>
                    <td><label id="solrMessage">...</label></td>
                </tr>
            </table>

        </div>
    </div>
</div>
<div class="clear"> </div>
<div class="footer">
    <p>&nbsp;</p>
</div>

<script>
    var contentPath = getContentPath();
    var url = contentPath+"/status/checkComponentStatus.do"
    //alert(url);
    $.get(url,function(data,status){
        if( status == "success" ){
            //var statusObj = eval('('+data+')'); 返回的就是json对象，不用转换。
            var statusObj = data;
            //alert(data);
            if(statusObj.code == '200'){
                var statusList = statusObj.list;
                for( var i = 0 ; i <　statusList.length; i++ ){
                    var dataObj = 　statusList[i];
                    document.getElementById(dataObj.name+"Status").innerHTML =dataObj.status;
                    document.getElementById(dataObj.name+"Cost").innerHTML =dataObj.cost;
                    var message = ((typeof(dataObj.message) == "undefined")?"":dataObj.message);
                    document.getElementById(dataObj.name+"Message").innerHTML = message;
                }
            }else{
                alert("加载服务状态失败")
            }
        }else {
            alert("请求失败，返回code="+status);
        }
    });
</script>
</body>
</html>